"""Build DTX tests"""


def scons():
    """Execute build"""
    Import('denv', 'vts_objs')

    libraries = ['abt', 'bio', 'dtx', 'vos', 'gurt', 'daos_common_pmem', 'cmocka', 'pthread',
                 'uuid', 'cart', 'daos_tests']

    tenv = denv.Clone()
    tenv.Append(CPPPATH=[Dir('..').srcnode()])
    tenv.Append(CPPPATH=[Dir('../../vos').srcnode()])
    tenv.Append(CPPPATH=[Dir('../../vos/tests').srcnode()])
    tenv.AppendUnique(CPPPATH=[Dir('../../common/tests').srcnode()])
    tenv.require('argobots')
    tenv.AppendUnique(RPATH_FULL=['$PREFIX/lib64/daos_srv'])
    tenv.Append(OBJPREFIX="b_")

    test_src = ['dtx_tests.c', 'sched_mock.c', 'ult_mock.c', 'srv_mock.c', 'pl_map_mock.c',
                '../../common/tls.c', 'dts_utils.c', 'dts_local.c', 'dts_local_rdb.c',
                'dts_structs.c', vts_objs]
    dtx_tests = tenv.d_program('dtx_tests', test_src, LIBS=libraries)

    tenv.Install('$PREFIX/bin/', [dtx_tests])


if __name__ == "SCons.Script":
    scons()
